<%-- 
    Document   : NicholasviewVotingList
    Created on : Apr 18, 2011, 8:45:45 PM
    Author     : ChuckToh
--%>
<%@page import="java.sql.ResultSet"%>
<%@page import="NicholasValueBeans.VotingList"%>
<h3>View Voting List</h3>
<%
            VotingList vl = new VotingList();
            ResultSet allVotingLists = vl.getAllVotingLists();
            ResultSet allVotingLists2 = vl.getAllVotingLists();
            int allVotingListsCount = 0;

            while (allVotingLists2.next()) {
                allVotingListsCount++;
            }

            if (allVotingListsCount > 0) {
                out.println("<table cellspacing='5' cellpadding='5' border='1'>");
                out.println("<tr>");
                out.println("<th align='left'>Voting List ID</th>");
                out.println("<th align='left'>Topics</th>");
                out.println("<th align='left'>Date Created</th>");
                out.println("<th align='left'>Commencement Date</th>");
                out.println("<th align='left'>Expiry Date</th>");
                out.println("</tr>");
                while (allVotingLists.next()) {
                    out.println("<tr>");
                    out.println("<td align='left'>" + allVotingLists.getString("id") + "</td>");
                    out.println("<td align='left'>" + allVotingLists.getString("topics") + "</td>");
                    out.println("<td align='left'>" + allVotingLists.getDate("dateCreated") + "</td>");
                    out.println("<td align='left'>" + allVotingLists.getDate("dateStart") + "</td>");
                    out.println("<td align='left'>" + allVotingLists.getDate("dateEnd") + "</td>");
                    out.println("</tr>");
                }
                out.println("</table>");
            } else {
                out.println("No voting list has been created yet!");
            }
%>
